package org.snackframework.core;

public class ModelView
{
	private final static String DEFAULT_KEY="defaultKey";
	private Object view;
	private ModelMap model;
	
	public ModelView()
	{}
	
	public ModelView(Object view)
	{
		this.view=view;
	}
	
	public ModelView(Object view,ModelMap model)
	{
		this.view=view;
		this.model=model;
	}
	
	public Object getView()
	{
		return view;
	}
	public void setView(Object view)
	{
		this.view = view;
	}
	public ModelMap getModel()
	{
		if(this.model==null)
			this.model=new ModelMap();
		return model;
	}
	public void setModel(ModelMap model)
	{
		this.model = model;
	}
	
	public void setDefaultModelValue(Object defaultValue)
	{
		model.put(DEFAULT_KEY, defaultValue);
	}
	
	public Object getDefaultModelValue()
	{
		return model.get(DEFAULT_KEY);
	}
}
